<%@page import="com.jsz.peini.common.util.PeiniUtils"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>${info.sellerName }</title>
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport" />
	
	<meta content="telephone=no" name="format-detection" />
	<link rel="stylesheet" href=" dist/css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/index.css">
	<link rel="stylesheet" type="text/css" href="css/store-delat.css">
	<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=qk5fYMC17KUfmYBTV1TzTjbeAG3W5iKq"></script>
	<script  type="text/javascript">
     	$(function() {
     		$(".atar_Show div").each(function(index, element) {
		        var num=$(this).attr("tip");
		        var www=num*2*9.5;//
		        $(this).css("width",www);
		    });
     	});
     	
     	$(document).ready(function (){
     		$(".act-details img").addClass('det-tu');
    		getLocation();
    	});
    	
    	function getLocation(){
    		var map = new BMap.Map("allmap");
    		var geolocation = new BMap.Geolocation();
    		geolocation.getCurrentPosition(function(r){
    			/* if(this.getStatus() == BMAP_STATUS_SUCCESS){
    		        var geoc = new BMap.Geocoder(); 
    				geoc.getLocation(r.point, function(rs){
    					var addComp = rs.addressComponents;
    					var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
    					alert(address);
    				}); 
    			}else {
    				alert('failed'+this.getStatus());
    			}  */
    			var pointA = r.point;
    			var pointB = new BMap.Point(${info.ypoint},${info.xpoint});
    			//alert(((map.getDistance(pointA,pointB))/1000).toFixed(2)+' 米。');
    			var str = ((map.getDistance(pointA,pointB))/1000).toFixed(1)+'km';
    			//alert(str);
    			$(".dist").html(str);
    		},{enableHighAccuracy: true})
    	}
    	
    	function toShow(url){
    		if(url != ''){
    			location.href=url;
    		}
    	}
    </script>

  </head>
  
  <body>
    <section class="banner">
		<div class="banner-div ">
			<div class="swiper-container">
		        <div class="swiper-wrapper" >
		        	<c:forEach items="${ads }" var="adv">
		        		<div class="swiper-slide"><img src="<%=PeiniUtils.IMGHOST %>${adv['adImgUrl'] }" onclick="toShow('${adv['adLink']}')"></div>
		        	</c:forEach>
		        </div>
		        <!-- Add Pagination -->
		        <div class="swiper-pagination"></div>
		  	</div>
		</div>
		<div class="infor-div">
			<div class="titl">
				<span>${info.sellerName }</span>
			</div>
			<div class="star">
				<div class="atar_Show">
		          <div tip="${info.sellerScore/20 }"></div>	          
		        </div>
		        <span>¥<fmt:formatNumber value="${info.price/100 }" pattern="#.00" />/人</span>
			</div>

			<c:if test="${info.weatherorder == 1 }">
				<div class="ord">
					店铺必须先预约
				</div>
			</c:if>
			
			<div class="dist"></div>
		</div>
		<div class="addres">
			<span>${info.sellerAddress }</span><a href="tel:${info.sellerPhone }"><i></i></a>
		</div>
		<div class="tags">
			<ul>
				<li>口味:${info.sellerMeal/20 }</li>
				<li>环境:${info.sellerServer/20 }</li>
				<li>服务:${info.sellerCondition/20 }</li>
				<c:if test="${info.isWifi ==1 }">
					<li  class="no"> </li>   <!-- 没有的情况下添加类  no -->
				</c:if>
				<c:if test="${info.isParking ==1 }">
					<li></li>  <!-- 没有的情况下添加类  no -->
				</c:if>
			</ul>
		</div>
	</section>
	<section class="buy-act">
		<div class="buy">
			<h6>买单</h6>
			<p>
				<c:if test="${goldC != null && goldC != '' }">
					金币买单<span>${goldC/10}</span>折&nbsp;&nbsp;
				</c:if>
				<c:if test="${wxC != null && wxC != '' }">
					金币买单<span>${wxC/10}</span>折&nbsp;&nbsp;
				</c:if>
				<c:if test="${aliC != null && aliC != '' }">
					金币买单<span>${aliC/10}</span>折
				</c:if>
			</p>
		</div>
		<div class="act">
			<h6>优惠</h6>
			<p>${youhui }</p>
		</div>
	</section>
	 <section class="act-details">
	 	<div >
	 		<h5>店铺介绍</h5>
	 		<p>${info.information }</p>
	 	</div>
	 </section>
	 <section class="down">
	 	<div>
	 		<span>时光因你而不同</span>
	 		<button onclick="download()">立即下载</button>
	 	</div>
	 </section>
 <script src=" dist/js/swiper.min.js"></script>
    <script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable: true,
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: 2500,
        autoplayDisableOnInteraction: false,
         slidesPerView: 1,
        loop: true
    });
    </script>
	<script type="text/javascript">
		function download(){
			var u = navigator.userAgent;
		    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
		    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
		    if(isAndroid == true){
		    	//alert("安卓");
		    	location.href="<%=PeiniUtils.ANDROIDURL%>";
		    }else{
		    	location.href="<%=PeiniUtils.IOSURL%>";
		    }
		    /* alert('是否是Android：'+isAndroid);
		    alert('是否是iOS：'+isiOS); */
		}
	</script>
  </body>
</html>
